<?php

namespace App\Http\Controllers\portal;

use App\Http\Controllers\Controller;
use App\Http\Requests\Article\ManagerRequest;
use App\Models\AdminManager;
use App\Http\Logic\ManagerLogic;

class ManagerController extends Controller
{
    //今日关注
    public function Attention()
    {

    }

    //募捐列表
    public function List(ManagerRequest $request)
    {
        $params = $request->all();
        $page_no = $params['page_no'] ?? 1;
        $page_size = $params['page_size'] ?? 20;
        switch ($params['type']) {
            case 'manager':
                $data = ManagerLogic::getManagerList($params, $page_no, $page_size);
                break;
            case 'fund':
                $data = ManagerLogic::getFundList($params, $page_no, $page_size);
                break;
            case 'education':
                $data = ManagerLogic::getEducationList($params, $page_no, $page_size);
                break;
        }
        return $this->success($data);
    }

    //捐赠分类
    public function typeList()
    {
        $data = ManagerLogic::getTypeList();
        return $this->success($data);
    }

    //统计计数
    public function count()
    {
        $data = [
            'CaringIndividuals' => 0, //爱心人士
            'TotalDonations' => 0, //捐款合计 TODO
            'LoveProject' => 0, //爱心项目
        ];
        $data['CaringIndividuals'] = ManagerLogic::getCaringIndividuals();
        $data['LoveProject'] = ManagerLogic::getProjectCount();
        $data['TotalDonations'] = ManagerLogic::getProjectAmountCount();
        return $this->success($data);
    }
}
